// let urlEnv = require("@/config/env");
import request from "@/axios";

let headers = {};
headers["X-Requested-With"] = "XMLHttpRequest";

// 登录
export const login = option =>
  request({
    url: "/api/auth/login",
    method: "post",
    data: option
  });

// 登录:验证手机验证码并登录
export const verifyLogin = option =>
  request({
    url: "/api/auth/verifyLogin",
    method: "post",
    data: option
  });

// 登录:发送登录手机验证码
export const sendLoginVericode = option =>
  request({
    url: "/api/auth/sendloginvericode",
    method: "get",
    params: option
  });

// 登录:获取图片验证码
export const loginCaptcha = () =>
  request({
    url: "/api/auth/login/captcha",
    method: "get",
    responseType: "blob"
  });

// 静默登录
export const silentLogin = option =>
  request({
    url: "/api/auth/silentlogin",
    method: "post",
    data: option
  });

// 注册
export const register = option =>
  request({
    url: "/api/user/register",
    method: "post",
    data: option
  });

// 注册:发送手机验证码
export const sendRegisterCode = option =>
  request({
    url: "/api/user/register/sendregistercode",
    method: "get",
    params: option
  });

// 注册:获取图片验证码
export const registerCaptcha = option =>
  request({
    url: "/api/user/register/captcha",
    method: "get",
    params: option,
    responseType: "blob"
  });

// 重置密码:获取图片验证码
export const resetPasswordCaptcha = option =>
  request({
    url: "/api/user/resetpassword/resetpasswordcaptcha",
    method: "get",
    params: option,
    responseType: "blob"
  });

// 重置密码:发送手机验证码
export const sendResetPasswordCode = option =>
  request({
    url: "/api/user/resetpassword/sendresetpasswordcode",
    method: "get",
    params: option
  });

// 重置密码
export const resetPassword = option =>
  request({
    url: "/api/user/resetpassword",
    method: "post",
    data: option
  });
